package cn.edu.scau.cmi.ZengLinghong.chapter04;

public class PerfectNumber {

	public static void main(String[] args) {
		for(int number=6; number<=1000; number++) {
			int sum = 1, sq = (int)Math.sqrt(number);
			if(sq*sq==number) sum-=sq;
			for(int factor=2; factor<=sq; factor++)
				if(number%factor==0) sum+=factor+number/factor;
			if(sum==number) System.out.println(number);
		}

	}

}
